#include <iostream>
#include "../macro.h"
#include <pthread.h>
#include <unistd.h>

using std::cout;
using std::endl;

void *func(void *p)
{

    printf("func running...\n");
    int a;
    scanf("%d", &a);
}

int main(int args, char *argv[])
{
    pthread_t thid;
    pthread_create(&thid, nullptr, func, nullptr);

    sleep(1);
    pthread_cancel(thid);
    pthread_join(thid, nullptr);    
    printf("func end\n");
    return 0;
}